package net.caixiaomi.info.adapter;

import android.support.annotation.LayoutRes;
import android.support.v4.content.ContextCompat;
import android.support.v7.widget.RecyclerView;
import android.widget.TextView;

import net.caixiaomi.info.R;
import net.caixiaomi.info.app.CommonApp;
import net.caixiaomi.info.base.quickadapter.BaseQuickAdapter;
import net.caixiaomi.info.base.quickadapter.BaseViewHolder;
import net.caixiaomi.info.model.MatchItem;

/**
 */

public class MatchFilterAdapter extends BaseQuickAdapter<MatchItem, BaseViewHolder> {

    public MatchFilterAdapter(@LayoutRes int layoutResId) {
        super(layoutResId);
    }

    @Override
    protected void convert(BaseViewHolder helper, MatchItem item) {
        try {
            TextView view = helper.getView(R.id.text);
            view.setText(item.getLeagueAddr());
            view.setSelected(item.isSelect());
            view.setTextColor(ContextCompat.getColor(CommonApp.getInstance(), view.isSelected() ? net.caixiaomi.info.R.color.white : net.caixiaomi.info.R.color.primary_text));
            view.setBackgroundResource(net.caixiaomi.info.R.drawable.btn_selected_button);

            RecyclerView.LayoutParams layoutParams = (RecyclerView.LayoutParams) helper.itemView.getLayoutParams();
            layoutParams.leftMargin = (int) CommonApp.getInstance().getResources().getDimension(net.caixiaomi.info.R.dimen.padding_8);
            layoutParams.bottomMargin = (int) CommonApp.getInstance().getResources().getDimension(net.caixiaomi.info.R.dimen.padding_8);
        } catch (Exception e) {
            e.printStackTrace();
        }


    }
}
